home *** CD-ROM | disk | FTP | other *** search
/ boe.pres.k12.wv.us / boe.pres.k12.wv.us.zip / boe.pres.k12.wv.us / Utilities / Xerox Workcentre 5335 / Windows Scan / 32-bit_x86 / Russian / cpsimage.cab / data / pdf / img2pdf.elf < prev    next >
Text File  |  2009-03-16  |  2KB  |  62 lines

  1.  
  2. // The TimeCheck() function reports the time to this point in the execution
  3. print "time to start interpreter = " + TimeCheck() + "secs";
  4.  
  5. // Get definitions and support procedures
  6. #import "documentio.ucm";
  7. #import "fiji2xip.ucm";
  8. #import "fwx2xip.ucm";
  9. #load   "xipProcs/printLayer.proc";
  10. #load   "xipProcs/getOcrPage.proc";
  11.  
  12. // Load image functions and methods
  13. LoadClasses ( filename: "xeng" );
  14.  
  15.  
  16. IMPORT STRING infile;
  17. IMPORT STRING language = "English";
  18. IMPORT INTEGER ocr = 1;     // Default is on
  19.  
  20. XIPIMAGE img;
  21. STRING ocrformat = "XDOC";
  22. STRING ocrxdoc, ocrxml;
  23.  
  24. // Test for proper parameters
  25. if ( !infile) {
  26.   print "Usage: \"xipe img2pdf.elf -im infile:s language:s ocr:i 0|1\" ";
  27.   end;
  28. }
  29.  
  30.  
  31. // Set output filename
  32. STRING outpdf = infile.name() + ".pdf";
  33.  
  34. if (infile.ext() == "jpg") {
  35.     img = readjpg (filename: infile, compressed:TRUE, rawcolor: TRUE);
  36. } else {
  37.     img = readimage (filename: infile);
  38. }
  39. print "FIJI Segmentation ...";
  40. XIPIMAGE ims = img.fijiSeg (cfgfile: "$XIPTOP/data/fiji/fijiNlc.cfg");
  41. print "Segmented image has " + ims.nlayers + " layers";
  42.  
  43.  
  44. if ( ocr ) {
  45.    print "OCR ...";
  46.    XIPIMAGE ocrimg = getOcrPage (input:ims, language: language);
  47.    ocrimg.setMember(member:"visibility", value: FALSE);
  48.    ims.addLayer(image:ocrimg, ltype: XIP_Text);
  49. }
  50.  
  51. // Make a DOCUMENTWRITER
  52. print "creating PDF writer";
  53. DOCUMENTWRITER docwrite = CreateDocumentWriter (filename:outpdf);
  54.  
  55. // Add page to the DOCUMENT
  56. docwrite.appendPage (pgImg: ims);
  57. docwrite.release();
  58.  
  59. // How long has this taken
  60. print TimeCheck();
  61. print "output pdf file = " + outpdf;
  62.